function father(name) {
    this.name = name
}
father.prototype.sayname = function(){
    return this.name
} 

function son(name,age) {
    this.age = age
    father.call(this, name)
}

function inherit(son, father) {
    let newFather = Object.create(father.prototype)
    son.prototype = newFather;
    son.prototype.constructor = son
}
inherit(son, father)

son.prototype.sayage = function(){
    return this.age
}

let son1 = new son("jiao",27)
console.dir(son1)
console.log(son1.sayage())
console.log(son1.sayname())